<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>

<form action="/admin/reg" method="post" id="form" >
<input type="hidden" name="_token" value="{{ csrf_token() }}">
用户名：<input type="text"  id="username" name="username"><br>
密码：<input type="password" id="password" name="password"><br>
<input type="submit" value="注册">
</form>


<script>
$(function(){
	$("#form").validate({
	    rules: {
	    	username : {  
	            required : true,  
	            minlength : 11, 
	            isMobile : true  
	        		}, 
	          },
	   messages: {
		   username : {  
		       required : "请输入手机号",  
		       minlength : "不能小于11个字符",  
		       isMobile : "请正确填写手机号码"  
		  		 	}
  				 },
		});
})

jQuery.validator.addMethod("isMobile", function(value, element) {  
 var length = value.length;  
 var mobile = /^(1[3-9][0-9]{9})$/;  
 return this.optional(element) || (length == 11 && mobile.test(value));  
}, "请正确填写手机号码");  

</script>